home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 3.0 KB | 115 lines | [TEXT/GEOL] |
- Item 3712812 28-Feb-90 09:23PST
-
- From: MADA2 MacApp Dev Assoc, Curtis Faith,IVC
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: ClickCount Bug Fix (Long!)
-
- I have implemented a workaround fix to the problem of inaccurate gClickCounts.
-
- These changes are entirely made in OVERRIDE's.
-
- 1) Add the global variable gSavedClickCount.
-
- 2) Change HandleMouseDown to save the ClickCount just before calling
- CountClicks. This will enable the TrackMouse method to determine whether the
- last mouse press changed gClickCount. This could be done with a boolean
- gClickCountChanged!?, I chose this route.
-
- 3) Change the end of TrackMouse to check the pending mouse-up event to see if
- this disqualifies the clickCount. Several notes:
-
- a) I made the assumption that there would always be a pending mouse-up event.
- I can't see why there would not be, as StillDown must have returned false.
-
- b) I removed the special case for movedOnce being FALSE. This did not allow
- one to check the time of the mouse press even if it did not move.
-
- c) I should perhaps have done the checking before ConstrainOnce ?
-
- These changes appear to fix the problem in all cases that I am able to test,
- however, these tests have not been by any means exhaustive.
-
- - Curtis
-
- VAR
- gSavedClickCount: Integer;
-
- {-----------------------------------+}
- {| HandleMouseDown |}
- {+-----------------------------------}
- {$S ARes}
- FUNCTION TMyApp.HandleMouseDown (VAR theEventInfo: EventInfo): TCommand;
- OVERRIDE;
-
- ( VAR's go here )
-
- BEGIN
- HandleMouseDown := gNoChanges;
-
- WITH theEventInfo, thePEvent^ DO
- BEGIN
- whereMouseDown := FindWindow(where, aWMgrWindow);\
- { +++ Added the following line }
- gSavedClickCount := gClickCount;
- theClickCount := CountClicks(thePEvent, whereMouseDown);
-
- aWindow := WMgrToWindow(aWMgrWindow);
-
- ( Rest of HandleMouseDown goes here )
-
- END;
-
- {-----------------------------------+}
- {| TrackMouse |}
- {+-----------------------------------}
- {$S ARes}
- FUNCTION TMyApp.TrackMouse (globalMouse, hysteresis: Point;
- theCommand: TCommand): TCommand;
- OVERRIDE;
-
- ( VAR's and local Procedures go here )
-
-
- BEGIN
- ( Setup Stuff goes here )
-
- WHILE StillDown DO
- ( StillDown Stuff goes here )
-
-
- DoFocus;
-
- { +++ Changed the following lines }
- { Notice that I removed the IF NOT movedOnce THEN special case }
-
- IF EventAvail(mUpMask, peekEvent) THEN
- BEGIN
- theQDMouse := peekEvent.where;
- IF view <> NIL THEN
- BEGIN
- GlobalToLocal(theQDMouse);
- view.QDToViewPt(theQDMouse, theMouse);
- END
- ELSE
- PtToVPt(theQDMouse, theMouse);
- ConstrainOnce;
- IF gClickCount > gSavedClickCount THEN
- BEGIN
- IF ((peekEvent.when - gLastUpTime) > GetDblTime) OR (NOT
- gTarget.DoMultiClick(gLastMsePt, peekEvent.where)) THEN
- gClickCount := gSavedClickCount;
- END;
- END;
- { +++ End of Changes }
-
- FeedbackOnce(FALSE, TRUE);
- TrackOnce(trackRelease, TRUE);
-
- TrackMouse := tracker;
-
- END;
-
-
-